
#include<bits/stdc++.h> 
using namespace std;
 const int MAXN = 3e5 + 5;
int n, a[MAXN];
std::map<int, int> mp;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    mp[a[i]]++;
  }
  int ps = -1;
  for (int i = 1; i <= n; ++i) {
    if (mp[a[i]] == 1) {
      if (ps == -1 || a[i] > a[ps]) {
        ps = i;
      }
    }
  }
  printf("%d ", ps);
  return 0;
}